<template>
  <div class="NewsDetial">
    <myheader title="文章详情">
      <span
        slot="left"
        class="van-icon van-icon-arrow-left"
        @click="$router.back()"
      >
        返回</span
      >
    </myheader>
    <div class="content">
      <div class="content" v-html="active.content"></div>
    </div>

    <comment :id="$route.params.id"></comment>
  </div>
</template>

<script>
import comment from "@/components/Comment.vue";
import myheader from "@/components/myheader";
import { getNews, getcomment } from "@/api/New.js";

export default {
  components: { comment, myheader },

  data() {
    return {
      active: [],
      pageindex: 1,
    };
  },

  async mounted() {
    let id = this.$route.params.id;
    console.log(id);
    let res = await getNews(id);
    console.log(res);
    this.active = res.data.message[0];
    // console.log(this.active);

    //评论

    // let res2 = await getcomment(id, { pageindex: this.pageindex });
    // console.log(res2);
  },
};
</script>

<style lang="less" scoped>
.NewsDetial {
  padding-bottom: 50px;
}
.content {
  text-indent: 2em;
}
</style>